import React, { useEffect } from "react";
import { queryOperateSupport } from "@/apis/charts";
import { useDispatch } from "react-redux";
import {
  setOperateData,
} from "@/store/features/operation_support";
const useSetOperateData = (times: string) => {
  //直接使用useDispatch分发dispatch
  const dispatch = useDispatch();
  const queryOperateData = async () => {
    const res = await queryOperateSupport({
      times: times,
    });
    dispatch(setOperateData(res));
  };
  useEffect(() => {
    queryOperateData();
  }, [times]);
};

export default useSetOperateData;
